package com.foodie.servlet;

import com.foodie.entity.Menu;
import com.foodie.service.selectService;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/img")
public class xiaoqinServlet extends HttpServlet {
    selectService s=new selectService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer id=Integer.parseInt(req.getParameter("id"));
//        System.out.println(id);

        List<Menu> userList = s.getselect( id);

        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().println(new Gson().toJson(userList));
    }
}
